import request from '@/utils/request'

// 获取用户列表
export function getList(params) {
  return request({
    url: '/admin/user/getList',
    method: 'get',
    params
  })
}

// 获取用户详细信息
export function getInfo(id) {
  console.log('execute get user ' + id + ' info')
  return request({
    url: '/admin/user/getInfo',
    method: 'post',
    data: {
      'target_id': id
    }
  })
}

// 更新用户详细信息
export function doEdit(updateParams) {
  return request({
    url: '/admin/user/doEdit',
    method: 'post',
    data: updateParams
  })
}

// 获取用户的成就
export function getAchieve(id) {
  return request({
    url: '/admin/user/getAchieve',
    method: 'post',
    data: {
      target_id: id
    }
  })
}

// 设置用户到黑名单中
export function setStatus(id) {
  console.log('api, set user in black list, ' + id)
  return request({
    url: '/admin/user/setStatus',
    method: 'post',
    data: {
      target_id: id
    }
  })
}

// 赠送茶叶
export function giveTea(id, count) {
  return request({
    url: '/admin/user/giveTea',
    method: 'post',
    data: {
      target_id: id,
      count: count
    }
  })
}

// 设置用户到黑名单中
export function setVip(id, days) {
  return request({
    url: '/admin/user/setVip',
    method: 'post',
    data: {
      userId: id,
      vipDays: days
    }
  })
}

// 获取用户订阅的主题
export function getUserThemes(data) {
  return request({
    url: '/admin/user_theme/getUserThemes',
    method: 'post',
    data
  })
}
